<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<html>
<head>
    <title>反馈建议 - 教育新闻网</title>
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .feedback-list {
            margin: 30px 0;
        }
        .feedback-item {
            padding: 20px;
            border: 1px solid #eee;
            border-radius: 8px;
            margin-bottom: 20px;
            transition: all 0.3s;
        }
        .feedback-item:hover {
            box-shadow: 0 2px 12px rgba(0,0,0,0.1);
            transform: translateY(-2px);
        }
        .feedback-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: #333;
            margin-bottom: 10px;
        }
        .feedback-content {
            color: #666;
            margin-bottom: 15px;
            line-height: 1.6;
        }
        .feedback-meta {
            color: #999;
            font-size: 0.9rem;
        }
        .feedback-meta span {
            margin-right: 15px;
        }
        .feedback-form {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 30px;
        }
    </style>
</head>
<body>
    <!-- 引入头部 -->
    <jsp:include page="/user/common/header.jsp"/>
    
    <div class="container">
        <h2 class="my-4">反馈建议</h2>
        
        <!-- 成功提示 -->
        <c:if test="${param.success == 'true'}">
            <div class="alert alert-success alert-dismissible fade show" role="alert">
                反馈提交成功！
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        </c:if>
        
        <!-- 错误提示 -->
        <c:if test="${not empty error}">
            <div class="alert alert-danger alert-dismissible fade show" role="alert">
                ${error}
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
        </c:if>
        
        <!-- 反馈表单 -->
        <div class="feedback-form">
            <form action="${pageContext.request.contextPath}/user/feedback/add" method="post">
                <div class="mb-3">
                    <label for="title" class="form-label">标题</label>
                    <input type="text" class="form-control" id="title" name="title" required>
                </div>
                <div class="mb-3">
                    <label for="content" class="form-label">内容</label>
                    <textarea class="form-control" id="content" name="content" rows="4" required></textarea>
                </div>
                <button type="submit" class="btn btn-primary">提交反馈</button>
            </form>
        </div>
        
        <!-- 反馈列表 -->
        <div class="feedback-list">
            <c:forEach items="${feedbackList}" var="feedback">
                <div class="feedback-item">
                    <h3 class="feedback-title">${feedback.title}</h3>
                    <div class="feedback-content">${feedback.content}</div>
                    <div class="feedback-meta">
                        <span>
                            <i class="bi bi-person"></i> 
                            ${empty feedback.realName ? feedback.username : feedback.realName}
                        </span>
                        <span>
                            <i class="bi bi-clock"></i> 
                            <fmt:formatDate value="${feedback.createTime}" pattern="yyyy-MM-dd HH:mm"/>
                        </span>
                    </div>
                </div>
            </c:forEach>
        </div>
        
        <!-- 分页 -->
        <c:if test="${totalPages > 1}">
            <nav>
                <ul class="pagination justify-content-center">
                    <li class="page-item ${currentPage == 1 ? 'disabled' : ''}">
                        <a class="page-link" href="${pageContext.request.contextPath}/user/feedback?page=${currentPage - 1}">上一页</a>
                    </li>
                    
                    <c:forEach begin="1" end="${totalPages}" var="i">
                        <li class="page-item ${currentPage == i ? 'active' : ''}">
                            <a class="page-link" href="${pageContext.request.contextPath}/user/feedback?page=${i}">${i}</a>
                        </li>
                    </c:forEach>
                    
                    <li class="page-item ${currentPage == totalPages ? 'disabled' : ''}">
                        <a class="page-link" href="${pageContext.request.contextPath}/user/feedback?page=${currentPage + 1}">下一页</a>
                    </li>
                </ul>
            </nav>
        </c:if>
    </div>
    
    <!-- 引入底部 -->
    <jsp:include page="/user/common/footer.jsp"/>
    
    <script src="${pageContext.request.contextPath}/static/js/bootstrap.bundle.min.js"></script>
</body>
</html> 